Skip to content

Android improvements needed for building NumPy and related packages#2695

Draft
mhsmith wants to merge 30 commits intopypa:mainfrom
mhsmith:android-numpy
Draft

Android improvements needed for building NumPy and related packages#2695
mhsmith wants to merge 30 commits intopypa:mainfrom
mhsmith:android-numpy

Conversation

@mhsmith
Copy link
Copy Markdown
Member

@mhsmith mhsmith commented Dec 16, 2025

Fixes for several issues found while building NumPy and related packages for Android:

  • Replace the limited built-in repair-wheel-command with full auditwheel support.

  • Add a shim which installs a Fortran compiler on demand, using a similar approach as we did for Rust.

  • Set up pkgconf in the build environment, and enable PKG_CONFIG_RELOCATE_PATHS. This is necessary for Meson, which uses pkgconf to find Python.

  • When a package builds against NumPy, replace platform-specific files with their Android equivalents, using a similar approach to pyodide-build.

This PR branch is temporarily used by several other PRs: see the cross-references below.

@mhsmith mhsmith changed the title Android improvements needed for building NumPy and SciPy Android improvements needed for building NumPy and related packages Dec 20, 2025
@henryiii
Copy link
Copy Markdown
Contributor

henryiii commented Feb 6, 2026

Is there anything you'd like to pull out and get in for the next version?

@mhsmith
Copy link
Copy Markdown
Member Author

mhsmith commented Feb 6, 2026

Not at the moment, thanks.

@mhsmith
Copy link
Copy Markdown
Member Author

mhsmith commented Apr 17, 2026

@mayeut: Since you're familiar with pypa/auditwheel#643, it might make sense for you to review this PR as well. It won't be ready to merge until the auditwheel work has been released, but it's otherwise complete.

Comment thread cibuildwheel/platforms/android.py Outdated
"x86_64": "x86_64-linux-android",
}

CROSS_BUILD_FILES = {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this shall go in the configuration in order to allow users to extend/override without the need for a new cibuildwheel version.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added an xbuild-files option, named that way for consistency with xbuild-tools.

setup_rust(config, python_dir, android_env)

# Create shims which install additional build tools on first use.
setup_fortran(android_env)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really want to maintain this ? Should it be an example instead ?
Fortran is not setup for Windows & macOS and it's up to projects using it to set it up, however they choose to do it.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it was simple to install the Android Fortran compiler then I would agree, but as you can see from the shim, it involves a complex merge of files from several different sources. The code to do this should be centralized somewhere, and cibuildwheel seems like the obvious choice, since it's already responsible for installing the other Android compilers (done by the android.py env command, which ultimately runs this script).

Fortran is a slow-moving language, so I don't expect this code will need to change very often. For example, previously I was using the Fortran compiler from GCC 4.9, which was released in 2014, but was still able to build SciPy 1.8.1, which was released in 2022.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants